!!!
%html
  %head
    %meta{'http-equiv' => "Content-type", :content => "text/html; charset=utf-8"}/
    %title
      = 'Ojay: ' + (@title || 'YUI development made easy')
    =javascripts 'yui/2.5.2', 'ojay/all-min'
    =stylesheets 'examples'
  %body
    #container
      #header
        .sub
          %h1 Ojay examples
          #versions
      #main
        .sub
          #content
            = yield
            
            :plain
              <h4 style="clear: both; margin-top: 60px;">JavaScript source code</h4>
              <textarea id="script-display"></textarea>
              <h4>Stylesheet</h4>
              <textarea id="style-display"></textarea>
              
              <script type="text/javascript">
                Ojay('#versions').setContent('YUI: ' + YAHOO.VERSION + ', Ojay: ' + (Ojay.VERSION || 'edge'));
                
                unindent = function(string) {
                    var lines = string.replace(/^(\s*\n)*/, '').replace(/(\n\s*)*$/, '').split(/\n/);
                    var indent = lines.reduce(function(memo, line) {
                        if (/^\s*$/.test(line)) return memo;
                        var spaces = line.match(/^ +/);
                        if (!spaces) return memo;
                        return Math.min(memo, spaces[0].length);
                    }, Infinity);
                    return lines.map({slice: indent}).join("\n");
                };
                
                showSource = function(name) {
                    var code = unindent(Ojay('#display-' + name).node.innerHTML);
                    Ojay('#' + name + '-display').setAttributes({value: code, rows: code.split(/\n/).length + 1});
                };
                
                showSource('script');
                showSource('style');
              </script>
      #footer
        .sub
    :plain
      <script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
        var pageTracker = _gat._getTracker("UA-3702125-1");
        if (/ojay\.othermedia\.org/.test(window.location.href)) {
          pageTracker._initData();
          pageTracker._trackPageview();
        }
      </script>
